package br.com.controleVendas.dao;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;

import br.com.controleVendas.entity.Cliente;
import br.com.controleVendas.entity.ClienteDto;

public class ClienteDao extends GenericDao<Cliente, ClienteDto>
{

    public List<ClienteDto> autoComplete(String nmCliente) throws Exception
    {
        ClienteDto filtro = new ClienteDto();
        filtro.setListCriterion(new ArrayList<Criterion>());
        filtro.getListCriterion().add(Restrictions.ilike("nmCliente", "%"+nmCliente.toLowerCase() +"%"));

        return getList(filtro);
    }

}
